
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--{template "wap_header"}-->
<!--{~ui('loader')->js('@jquery')}-->
<style>
body {
font: 12px/1.5 \5fae\8f6f\96c5\9ed1,\5b8b\4f53,georgia,verdana,helvetica,sans-serif;
}
#hd, #bd, #ft {
width: 100%;
}
.mod {
width: 100%;
}
h2 {
font-size: 100%;
font-weight: normal;
}
.mod h2 {
height: 30px;
line-height: 30px;
border-top: 1px solid #d0d0d0;
border-bottom: 1px solid #d0d0d0;
background: -moz-linear-gradient(top,#fff,#f0f0f0);
background: -webkit-linear-gradient(top,#fff,#f0f0f0);
color: #f57900;
font-size: 14px;
padding-left: 15px;
}
.mod table {
width: 100%;
}
.mod td {
line-height: 38px;
text-align: center;
}
.mod td {
width: 25%;
height: 38px;
line-height: 38px;
text-align: center;
border-bottom: 1px solid #d0d0d0;
border-right: 1px solid #d0d0d0;
}
.mod td a {
display: block;
height: 38px;
margin: 0 auto;
text-align: center;
color: #333;
font-size: 12px;
}
.cur td a {
display: block;
text-align: center;
}
.cur td a.cur-city {
cursor: default;
}
.mod .last td {
border-bottom: 0;
}
.mod td.last {
border-right: 0;
}
.cur td a span {
background: url(http://p5.qhimg.com/t018b63d6154db96070.png) no-repeat;
background-size: 15px 40px;
padding: 4px 1px 4px 20px;
}
.cur td a.locate span {
background-position: 0 -21px;
}
.message-pop {
display: none;
position: fixed;
bottom: 0;
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
opacity: .7;
background-color: #000;
color: #fff;
}
</style>
</head>
<body id="account"> 
<header class="">
                <div class="left-box">
                    <a class="goback" href="wap.php"><label gaevent="InnerLink|Click|touch/back">首页</label></a>
                </div>
                <h1>选择城市</h1>
            </header>

<div id="bd">
				<!-- S: 当前城市 -->				
				<!-- 当前城市 -->
<div class="mod cur" bk="tuan_m_city_position">
	<h2>当前城市</h2>				
	<table>
		<tr class="last">
            <td><a href="###" class="cur-city" id="city"><span>{~logic('misc')->City('name')}</span></a></td>						
			<td class="last"><a href="javascript:getlocation();" class="locate"><span id="dingwei">重新定位</span></a></td>
		</tr>
	</table>
</div>

<div class="message-pop">	
</div>				<!-- E: 当前城市 -->				

				<!-- S: 热门城市 -->		
				<!-- 热门城市 -->
<div class="mod hot" bk="tuan_m_city_hot">
	<h2>热门城市</h2>
    <table>
    <!--{eval $temp=0}-->
               <!--{loop logic('misc')->CityList() $i $value}-->
               			{if $i==0||$i%4==0}
               			<tr>
               			{/if}
                		{if ($i+1)%4!=0}
                		<td ><a href="wap.php?city={$value['shorthand']}">{$value['cityname']}</a></td>
                		
                		{else}
                		<td class="last"><a href="wap.php?city={$value['shorthand']}">{$value['cityname']}</a></td>
                		</tr>
                		{/if}
                       <!--{eval $temp = $i}-->
                        <!--{/loop}-->	
                     {if $temp%4!=0}   	
            		</tr>
            		{/if}
            		
               
        	</table>				
</div>				<!-- E: 热门城市 -->	
</div>


<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=7srQsDLP8QRXIjMEYVkPGI6n"></script>
<script type="text/javascript">

// 百度地图API功能
function getlocation(){
	var map = new BMap.Map("allmap");
	var gc = new BMap.Geocoder();  
	var geolocation = new BMap.Geolocation();
	$("#dingwei").html("正在定位...");
	geolocation.getCurrentPosition(function(r){
	    if(this.getStatus() == BMAP_STATUS_SUCCESS){

			var pt = r.point;
			gc.getLocation(pt, function(rs){
		        var addComp = rs.addressComponents;
		        var city = addComp.city.replace("市",""); 
		        $.get('wap.php?code=getLocation&city='+city+$.rnd.stamp(), function(data){
		        	location.href="wap.php";
		        	$("#city").text(data);
		        	 $("#dingwei").html("重新定位");
		        });
		        
	        //alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
	   		});  

	    }
	    else {
	        alert('定位失败,请手动选择城市!');
	        $("#dingwei").html("重新定位");
	    }        
	},{enableHighAccuracy: true,timeout:5000,maximumAge:30000});
	setTimeout(function(){
		if(typeof(geolocation.getStatus())=='undefined'){
			alert('定位失败,请手动选择城市!');
	        $("#dingwei").html("重新定位");
		}	 
		},6000);
	

}

//关于状态码
//BMAP_STATUS_SUCCESS	检索成功。对应数值“0”。
//BMAP_STATUS_CITY_LIST	城市列表。对应数值“1”。
//BMAP_STATUS_UNKNOWN_LOCATION	位置结果未知。对应数值“2”。
//BMAP_STATUS_UNKNOWN_ROUTE	导航结果未知。对应数值“3”。
//BMAP_STATUS_INVALID_KEY	非法密钥。对应数值“4”。
//BMAP_STATUS_INVALID_REQUEST	非法请求。对应数值“5”。
//BMAP_STATUS_PERMISSION_DENIED	没有权限。对应数值“6”。(自 1.1 新增)
//BMAP_STATUS_SERVICE_UNAVAILABLE	服务不可用。对应数值“7”。(自 1.1 新增)
//BMAP_STATUS_TIMEOUT	超时。对应数值“8”。(自 1.1 新增)
</script>

<!--{template "wap_footer"}-->


</body>
</html>